package com.cy.letcode.number.回文数;

class Solution {

    public static void main(String[] args) {
        System.out.println(isPalindrome(123211));
    }

    public static boolean isPalindrome(int x) {
        if (x < 0 || (x % 10 == 0 && x != 0)) {
            return false;
        }
        int p = 0;
        while (x > p) {
            p = p * 10 + x % 10;
            x /= 10;
        }
        //奇数和偶数的区别
        return x == p || x == p / 10;
    }
}